package com.bw.service.impl;

import com.bw.entity.Book;
import com.bw.mapper.BookMapper;
import com.bw.mapper.impl.BookMapperImpl4;
import com.bw.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class BookServiceImpl implements BookService {

    @Autowired // 给属性赋值  从容器中查找一个对象  (根据属性的类型去查找)
 //   @Qualifier("")
    //@Resource  // 给属性赋值  根据属性名去匹配对象  ，
    private BookMapper bookMapper;


    public BookMapper getBookMapper() {
        return bookMapper;
    }

    public void setBookMapper(BookMapper bookMapper) {
        System.out.println("--------有人给mapper 赋值了-------------");
        this.bookMapper = bookMapper;
    }

    @Override
    public void addBook(Book book) {
        System.out.println("---BookServiceImpl 开始 执行 addBook");

        bookMapper.addBook(book);
    }
}
